<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/base/BaseFormFilterPropel.class.php');

/**
 * Personne filter form base class.
 *
 * @package    TC5
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormFilterGeneratedTemplate.php 13459 2008-11-28 14:48:12Z fabien $
 */
class BasePersonneFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'nom'           => new sfWidgetFormFilterInput(),
      'prenom'        => new sfWidgetFormFilterInput(),
      'pseudo'        => new sfWidgetFormFilterInput(),
      'email'         => new sfWidgetFormFilterInput(),
      'password'      => new sfWidgetFormFilterInput(),
      'date_creation' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'is_admin'      => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'adresse'       => new sfWidgetFormFilterInput(),
      'code_postal'   => new sfWidgetFormFilterInput(),
      'ville'         => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'nom'           => new sfValidatorPass(array('required' => false)),
      'prenom'        => new sfValidatorPass(array('required' => false)),
      'pseudo'        => new sfValidatorPass(array('required' => false)),
      'email'         => new sfValidatorPass(array('required' => false)),
      'password'      => new sfValidatorPass(array('required' => false)),
      'date_creation' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'is_admin'      => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'adresse'       => new sfValidatorPass(array('required' => false)),
      'code_postal'   => new sfValidatorPass(array('required' => false)),
      'ville'         => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('personne_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Personne';
  }

  public function getFields()
  {
    return array(
      'id'            => 'Number',
      'nom'           => 'Text',
      'prenom'        => 'Text',
      'pseudo'        => 'Text',
      'email'         => 'Text',
      'password'      => 'Text',
      'date_creation' => 'Date',
      'is_admin'      => 'Boolean',
      'adresse'       => 'Text',
      'code_postal'   => 'Text',
      'ville'         => 'Text',
    );
  }
}
